import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PurchaseOrderItemListVO, PurchaseOrderItemListForm, PurchaseOrderItemListQuery } from '@/api/lingxing/purchaseOrderItemList/types';

/**
 * 查询领星采购单子项列表
 * @param query
 * @returns {*}
 */

export const listPurchaseOrderItemList = (query?: PurchaseOrderItemListQuery): AxiosPromise<PurchaseOrderItemListVO[]> => {
  return request({
    url: '/lingxing/purchaseOrderItemList/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星采购单子项详细
 * @param id
 */
export const getPurchaseOrderItemList = (id: string | number): AxiosPromise<PurchaseOrderItemListVO> => {
  return request({
    url: '/lingxing/purchaseOrderItemList/' + id,
    method: 'get'
  });
};

/**
 * 新增领星采购单子项
 * @param data
 */
export const addPurchaseOrderItemList = (data: PurchaseOrderItemListForm) => {
  return request({
    url: '/lingxing/purchaseOrderItemList',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星采购单子项
 * @param data
 */
export const updatePurchaseOrderItemList = (data: PurchaseOrderItemListForm) => {
  return request({
    url: '/lingxing/purchaseOrderItemList',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星采购单子项
 * @param id
 */
export const delPurchaseOrderItemList = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/purchaseOrderItemList/' + id,
    method: 'delete'
  });
};
